<?php
declare (strict_types=1);

namespace app\common\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class Comment extends Model
{
    //  连接数据库
    protected $connection = 'bairui';
    //  连接表名
    protected $name = 'comment';
    //  自动写入时间戳字段
    protected $createTime = 'created_at';
    protected $updateTime = 'updated_at';

    public function member()
    {
        return $this->hasOne('member', 'id', 'member_id')->field('id,account');
    }

    public function article()
    {
        return $this->hasOne('article', 'id', 'article_id')->field('id,title');
    }
}
